<template>
    <div class="vitalSignsContent" :style="{'height':(height==null?divAutoHeight:height)+'px','width':(width==null?divAutoWidth:width)+'px', 'overflow-y':'auto'}">
              <h3 class="dialog-plate-title"><span>当日体征检测</span></h3>
              <el-form :inline="true" :model="vitalsigns"  label-width="120px" class="demo-ruleForm">
                      <el-form-item label="体重/kg" prop="weight"><el-input v-model="vitalsigns.weight"></el-input></el-form-item>
                      <el-form-item label="体温/℃" prop="animalHeat"><el-input v-model="vitalsigns.animalHeat"></el-input></el-form-item>
                      <el-form-item label="脉搏/B/M" prop="pulse"><el-input v-model="vitalsigns.pulse"></el-input></el-form-item>
                      <br/>
                      <el-form-item label="血压/KPa">
                          <el-row style="width: 480px;">
                            <el-col :span="25"><el-form-item prop="lowBlood"><el-input  v-model="vitalsigns.lowBlood"></el-input></el-form-item></el-col>
                            <el-col class="line" :span="1">-</el-col>
                            <el-col :span="25"><el-form-item prop="highBlood"><el-input  v-model="vitalsigns.highBlood"></el-input></el-form-item></el-col>
                          </el-row>
                      </el-form-item>
                      <el-form-item label="体检护士"><el-input v-model="vitalsigns.bodyCheckWorkerName" disabled></el-input></el-form-item>
              </el-form>  
              <h3 class="dialog-plate-title"><span>历史体征</span></h3>
              <div style="width:100%;height:300px;overflow-y:auto;">
                <el-table
                    ref="multipleTable"
                    :data="tableData"
                    @selection-change="handleSelectionChange" stripe border>
                        <el-table-column prop="weight" label="体重/kg" sortable min-width="120"></el-table-column>
                        <el-table-column prop="animalHeat" label="体温/℃" sortable min-width="120"></el-table-column>
                        <el-table-column prop="pulse" label="脉搏/B/M" sortable min-width="120"></el-table-column>
                        <el-table-column prop="lowBlood" label="血压/KPa" sortable min-width="120"></el-table-column>
                        <el-table-column prop="bodyCheckWorkerName" label="体检护士" sortable min-width="120"></el-table-column>
                        <el-table-column prop="recodeCreateTime" label="体检时间" sortable min-width="120"></el-table-column>
                </el-table>     

              </div>
    </div>
</template>
<script>
import bodyCheckApi from 'plugins/myaxios/bodycheck/bodyCheck.js';
export default {
    props:['width','height','idCard','cVal','bodyRecodeId','providerId'],
    data(){
        return{
             vitalsigns:{
                createNurseName:localStorage.getItem('ms_username'),
                weight:'',
                animalHeat:'',
                pulse:'',
                lowBlood:'',
                highBlood:'',
            },
            tableData:[],
        }
    },
    created(){
        this.$nextTick(()=>{
            let self = this;
            self.init();
        });        
    },
    watch:{
        idCard(newData,oldData){
            let self = this;
            console.log(newData);
            self.idCard = newData;
        },
        cVal(newData,oldData){
            let self = this;
            self.queryVitalSigns();
            self.queryHistoryVitalSigns();
        },
        bodyRecodeId(newData,oldData){
            let self = this;
        },
    },
    computed:{
        divAutoHeight(){
            return this.$store.state.clientHeight;
        },
        divAutoWidth(){
            return this.$store.state.clientWidth;
        },
        tableHeight() {
            return this.$store.state.clientHeight - 184;
        },
    },
    methods:{
        //进行插件封装
        init(){
            let self = this;
            self.queryVitalSigns();
            self.queryHistoryVitalSigns();  //查询历史数据
        },
        submitDialog(){/** 更新后台信息*/
            let self = this;
            self.loading=true;
            let params = {
                weight:self.dialogList.weight,
                animalHeat:self.dialogList.animalHeat,
                pulse:self.dialogList.pulse,
                lowBlood:self.dialogList.lowBlood,
                highBlood:self.dialogList.highBlood,
                bodyRecodeId:self.dialogList.bodyRecodeId,
            }
            bodyCheckApi.addUpdataCheckBodyInfo(params).then(res=>{
                self.$message.success('信息编辑成功！');
            },error=>{
            })
        },
        //查询数据
        queryVitalSigns(){
            let self = this;
            bodyCheckApi.queryVitalSigns(self.bodyRecodeId).then(res=>{
                self.vitalsigns = res.content;
           },error=>{
            })
        },
        queryHistoryVitalSigns(){
            let self = this;
            bodyCheckApi.queryHistoryVitalSigns(self.providerId).then(res=>{
               self.tableData =res.content;
           },error=>{
            })

        },
        handleSelectionChange(val) {
            this.multipleSelection = val;
        },
    },
}
</script>
<style scoped>
.vitalSignsContent{
}
</style>